package com.example.piedrapapeltijeralagartospok;

import java.io.IOException;

import controlador.Controlador;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;

public class MainActivity extends Activity implements OnClickListener {

	private Controlador c = new Controlador(this);

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_main);

		Button computadora = (Button) findViewById(R.id.maquina);

		computadora.setOnClickListener(this);

		Button jugador = (Button) findViewById(R.id.jugador);

		jugador.setOnClickListener(this);
		
		

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {

		if (!c.onOptionsItemSelected(item)) {

			super.onOptionsItemSelected(item);

		}
		return true;
	}

	@Override
	public void onActivityResult(int requestCode, int resultCode, Intent data) {
		try {
			c.onActivityResult(requestCode, resultCode, data);
		} catch (IllegalArgumentException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalStateException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	public Button getContraJugador() {
		Button sh = (Button) findViewById(R.id.jugador);
		return sh;
	}

	public Button getContraMaquina() {
		Button sh = (Button) findViewById(R.id.maquina);
		return sh;
	}

	@Override
	public void onClick(View v) {
		c.onClick(v);
	}

}
